package com.foxchen.textinputapp.controller;

import com.foxchen.textinputapp.common.ResponseBean;
import com.foxchen.textinputapp.dto.CheckCodeDTO;
import com.foxchen.textinputapp.dto.TableUserDTO;
import com.foxchen.textinputapp.service.TableUserService;
import com.foxchen.textinputapp.vo.LoginVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@Tag(name = "body参数")
public class TableUserController {
    @Resource
    private TableUserService tableUserService;

    @Operation(summary = "登录接口")
    @PostMapping("login")
    public ResponseBean<TableUserDTO> login(@RequestBody @Valid LoginVO request){
        return ResponseBean.success(tableUserService.login(request));
    }

    @Operation(summary = "获取验证码接口")
    @GetMapping("get-check-code")
    public ResponseBean<CheckCodeDTO> getCheckCode(){
        return ResponseBean.success(tableUserService.getCheckCode());
    }
}
